package homepage

import (
	"net/http"

	"github.com/gin-gonic/gin"
	"go-papers/models"
	"go-papers/tools/app"
)

func GetSystemItems(c *gin.Context) {
	var data models.DictData
	var err error
	code := c.Request.FormValue("code") // 字段类型
	result, err := data.GetSearchPage(code)
	if err != nil {
		app.ApiResp(c, -1, "数据操作失败："+err.Error(), nil)
		return
	}

	var mp = make(map[string]interface{}, 3)
	mp["list"] = result
	mp["count"] = len(result)
	var res app.Response
	res.Data = mp

	c.JSON(http.StatusOK, res.ReturnOK())
}
